<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加系统用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script language="JavaScript" src="../../static/js/jquery-3.5.1.js"></script>
    <link rel="stylesheet" href="../../static/plugins/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/layui_ext.css" media="all">
</head>

<body>
<div class="layui-fluid" style="padding-top:20px">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">修改个人信息</div>
                <div class="layui-card-body" pad15>
                    <form action="" class="layui-form" lay-filter="form">
                        <input type="hidden" name="actions" value="#(form.actions)">
                        <input type="hidden" name="emp_id" value="#(user.emp_id)">
                        #(token??)

                        <div class="layui-row layui-col-space15">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">所属部门</label>

                                    <div class="layui-input-block">
                                        <input type="text" value='#(form.select.get("deptid"))' class="layui-input input-readonly" >

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">登陆帐号</label>

                                    <div class="layui-input-block">
                                        <input type="text" name="login_id" placeholder="请输入帐号"
                                               lay-verify="login_id" value="#(user.login_id)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">用户姓名</label>

                                    <div class="layui-input-block">
                                        <input type="text" name="user_name" placeholder="请输入姓名"
                                               value="#(user.user_name)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">邮箱</label>

                                    <div class="layui-input-block">
                                        <input type="text" name="user_email" placeholder="请输入邮箱"
                                               value="#(user.user_email)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">手机号</label>

                                    <div class="layui-input-block">
                                        <input type="text" name="user_phone" placeholder="请输入手机号"
                                               value="#(user.user_phone)" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="Submit1">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../static/plugins/layui/layui.js"></script>

<SCRIPT LANGUAGE="JavaScript">
    <!--
    layui.config({
        base: '../../static/plugins/layuiadmin/' //静态资源所在路径
    }).use('index');

    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(Submit1)', function (data) {
            var index = layer.load(1);
            $.ajax({
                type: 'POST',
                url: "ModifyMyInfoApi",
                data: "postdata=" + JSON.stringify(data.field),
                success: function (results) {
                    if (results.code == 0) {
                        layer.alert(results.msg, {offset: '100px'}, function (index2) {
                            layer.close(index2);
                            layer.close(index);
                        });
                    } else {
                        layer.close(index);
                        layer.msg("保存数据失败[" + results.msg + "]，请重试");
                    }
                    return false;
                },
                error: function (return_data) {
                    layer.close(index);
                    layer.msg("保存数据失败，请重试" + JSON.stringify(return_data));
                    return false;
                },
                dataType: "json"
            });
            return false;
        });

        //较验监督方
        form.verify({
            dept_id: function (value, item) {
                if (value == '') {
                    return '请选择部门';
                }
            },
            login_id: function (value, item) {
                if (value == '') {
                    return '请输入登陆帐号';
                } else {
                    var checkResult = "";
                    $.ajax({
                        type: 'GET',
                        url: "CheckLoginidApi",
                        async: false,
                        data: {login_id: value, emp_id: '#(user.emp_id)'},
                        success: function (results) {
                            if (results.code == 9) {
                                checkResult = "登陆帐号已存在";
                            }
                        },
                        error: function (return_data) {
                        },
                        dataType: "json"
                    });
                    return checkResult;
                }
            }
        });
    });
    //-->
</SCRIPT>
</body>
</html>